Skip to content

Fix add_clips leaving stranded audio when overwriting linked clips#124

Open
PriyeshPandey2000 wants to merge 1 commit into
palmier-io:mainfrom
PriyeshPandey2000:fix/add-clips-stranded-linked-audio
Open

Fix add_clips leaving stranded audio when overwriting linked clips#124
PriyeshPandey2000 wants to merge 1 commit into
palmier-io:mainfrom
PriyeshPandey2000:fix/add-clips-stranded-linked-audio

Conversation

@PriyeshPandey2000

@PriyeshPandey2000 PriyeshPandey2000 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

clearRegion calls splitClip (which splits linked partners on both tracks) then removeClips (which only removes the given clip id). When add_clips overwrites a linked V+A pair, the audio fragment in the cleared range is never removed. placeClip then finds the audio track occupied and creates a spurious second audio track, causing the original audio to play under the new clip.

Fix collects linked partner track IDs before clearing the video track, then issues a second clearRegion on each partner track. placeClip finds the audio track clear and routes the new audio there correctly.


Note

Medium Risk
Changes agent timeline mutation behavior for linked V+A overwrites; scope is narrow with a targeted regression test, but incorrect partner detection could clear wrong tracks.

Overview
Fixes add_clips overwriting a linked video+audio span so linked audio in the cleared range is removed instead of left behind.

Before placing each clip, when the target track is video, the handler gathers linked partner track IDs for clips overlapping the placement range, runs clearRegion on the video track, then runs clearRegion on each partner track for the same frame range. That avoids stranded audio after clearRegion splits linked partners but only removes fragments on the track being cleared— which previously caused double playback and an extra audio track when placeClip saw A1 still occupied.

Adds regression test addClipsClearsLinkedAudioWhenOverwritingLinkedPair for middle-overwrite of a linked V+A pair.

Reviewed by Cursor Bugbot for commit 692bd2c. Bugbot is set up for automated code reviews on this repo. Configure here.

@PriyeshPandey2000
PriyeshPandey2000 force-pushed the fix/add-clips-stranded-linked-audio branch 2 times, most recently from 349e77b to 4b776e1 Compare June 26, 2026 04:07
TimLai666 added a commit to TimLai666/fronda that referenced this pull request Jul 10, 2026
First-ever complete inventory (207 PRs / 79 issues). Multicam passthrough
already landed; tool-surface v2 (palmier-io#263) flagged as a user decision; two
verified-in-Rust bugs (palmier-io#263 ripple fixpoint, palmier-io#124 stranded audio) and
three UNVERIFIED checks queued. Also drops the now-unused GenerationInput
lib import.
TimLai666 added a commit to TimLai666/fronda that referenced this pull request Jul 10, 2026
…ruption bugs, palmier-io#264 overflow ceiling, palmier-io#36/palmier-io#268 ports, palmier-io#139/palmier-io#212 verified

TDD per item (RED repro first, then fix):

palmier-io#124 (BUG-FIXED): place_clips overwriting a linked V+A pair cleared only the
target track — the audio partner's range stayed (double playback) and new
linked audio was pushed onto a spurious extra track. Now a video-track
overwrite clears the same range on linked-partner tracks (mirrors Swift PR
4b776e1's video-gated semantics); audio-track placement stays track-local.

palmier-io#263 (BUG-FIXED): compute_ripple_delete partner propagation only scanned the
anchor track, so linked partners of clips on cleared sync-locked tracks were
left behind on lock-off tracks (desync). Propagation is now a worklist
fixpoint across ALL cleared tracks; palmier-io#227 sync-follower and palmier-io#207 ignore-set
semantics unchanged.

palmier-io#264/palmier-io#265 (BUG-FIXED): near-i64::MAX frame/duration args crashed the process
(debug 'attempt to add with overflow' in insert/move/apply_layout/add_texts;
set_clip_properties silently stored poisoned values). Shared MAX_TOOL_FRAME
(1e9, upstream maxToolFrame) + require_frame_in_bounds in mutation.rs, wired
into both the mutation validators and the executor's live arg parsing
(resolve_placement, insert_clips frame incl. >=0 guard, move_clips toFrame,
split_clips atFrame/frames, set_clip_properties duration/trims, apply_layout,
add_texts). ripple_delete_ranges stays clamp-tolerant like upstream.

palmier-io#139 (VERIFIED-OK): format_timecode already uses drop-adjusted divisors
(1798/17982); frame 1800 @29.97DF = 00;01;00;02 pre-existing test confirmed,
10-minute-boundary assertions added (17982 -> 00;10;00;00).

palmier-io#212 (VERIFIED-OK + guard): speed 0.1 legal end-to-end, duration math pinned
(150f @1.0 -> 1500f @0.1). Fixed the live executor silently storing
speed <= 0 — now rejects 'speed must be > 0' like Swift.

palmier-io#36 (PORTED): AnthropicConfig::from_env honours ANTHROPIC_BASE_URL (trimmed,
blank falls back to the public API); chat_view uses it; URL construction
unit-tested via pure resolve_base_url.

palmier-io#268 (PORTED): sonnet5-family requests carry output_config.effort=low
(shape from upstream AgentClientTypes.swift), applied in build_agent_request
AND the live run_agent_turn body; snapshot + ScriptedTransport tests.

Gates (exit code 0): cargo test --workspace; cargo test -p
fronda-app-shell-gpui --features desktop-app; cargo check -p
fronda-app-shell-gpui --features desktop-app --bin fronda.
TimLai666 added a commit to TimLai666/fronda that referenced this pull request Jul 10, 2026
All 8 items verdicted: palmier-io#124 stranded audio + palmier-io#263 ripple fixpoint
BUG-FIXED (TDD, upstream-diff-matched), palmier-io#139 drop-frame + palmier-io#212 speed
VERIFIED-OK (with boundary pins + a speed<=0 guard), palmier-io#264 overflow ceiling
+ palmier-io#36 base URL + palmier-io#268 sonnet5 effort:low PORTED. 19 new tests. Residuals
flagged: mutation.rs is a dormant validation layer (live path never calls
it - palmier-io#144's checks included), and cmd_add_texts ignores startFrame (chip
task_14403ebd).
clearRegion calls splitClip (which splits linked partners on both tracks)
then removeClips (which only removes the given clip id). When add_clips
overwrites a linked V+A pair, the audio fragment in the cleared range
is never removed. placeClip then finds the audio track occupied and
creates a spurious second audio track, causing the original audio to
play under the new clip.

Fix collects linked partner track IDs before clearing the video track,
then issues a second clearRegion on each partner track. placeClip finds
the audio track clear and routes the new audio there correctly.
@PriyeshPandey2000
PriyeshPandey2000 force-pushed the fix/add-clips-stranded-linked-audio branch from 4b776e1 to 692bd2c Compare July 21, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant